package com.formina.engine;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;


import android.content.Context;
import android.media.AudioManager;
import android.media.SoundPool;
import android.opengl.GLSurfaceView.Renderer;
import android.view.MotionEvent;


public class GameRenderer  implements Renderer {
	
	protected List<Model> Models = new ArrayList<Model>();
	protected List<Effect> Effects =new ArrayList<Effect>();

	protected long loopStart = 0;
	protected long loopEnd = 0;
	protected long loopRunTime = 0 ;
	protected SoundPool soundPool;
	protected HashMap<Integer, Integer> soundPoolMap;
	float Width,Height;


	//FPS
    public double fps;
	//END FPS
	
	public GameRenderer(){
		
	}
		
	public void HandleTouch(MotionEvent ev){
		
		
	}
	
	
	
	public void playSound(int sound) {
	    /* Updated: The next 4 lines calculate the current volume in a scale of 0.0 to 1.0 */
	    AudioManager mgr = (AudioManager)Engine.CONTEXT.getSystemService(Context.AUDIO_SERVICE);
	    float streamVolumeCurrent = mgr.getStreamVolume(AudioManager.STREAM_MUSIC);
	    float streamVolumeMax = mgr.getStreamMaxVolume(AudioManager.STREAM_MUSIC);    
	    float volume = streamVolumeCurrent / streamVolumeMax;
	    
	    /* Play the sound with the correct volume */
	    soundPool.play(soundPoolMap.get(sound), volume, volume, 1, 0, 1f);     
	}
	
	public void onDrawFrame(GL10 gl) {
		
	}
	
	public void onSurfaceChanged(GL10 gl, int width, int height) {
		
	     
	}
	
	public void onSurfaceCreated(GL10 gl, EGLConfig config) {
		
	}
	
	 
}
	

